package com.search.listener;

import com.search.constatnts.MqConstants;
import com.search.sevice.ISearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class MqQueueListener {

    @Autowired
    private ISearchService iSearchService;

    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void listenerItemInsertOrUpdate(long id){
        iSearchService.insertById(id);
    }

    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void listenerItemDelete(long id){
        iSearchService.deleteById(id);
    }

}
